#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>
int my_atoi(char* str)
{
	assert(str);
	int flag = 1;
	int n = 0;
	if (*str == '\0')
		return 0;
	while (*str == ' ')
		str++;
	if (*str == '+')
	{
		flag = 1;
		str++;
	}
	if (*str == '-')
	{
		flag = -1;
		str++;
	}
	while (*str)
	{
		n = n * 10 + (*str - '0');
		str++;
	}
	n = n * flag;
	return (int)n;
}
int main()
{
	char arr[] = "-12345";
	int ret = my_atoi(arr);
	printf("%d", ret);

	return 0;
}